unit udlgMessage;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, udlgCustomDlgForm, Vcl.Buttons, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.Imaging.pngimage;

type
  TdlgMessage = class(TdlgCustomDlgForm)
    Image_Info: TImage;
    lText: TStaticText;
    Image_Error: TImage;
  private
  public
  end;

  procedure dlgShowMessageDlg(Owner: TComponent; const Caption, Msg: string; IsError: boolean = False;
    Height: integer = 125);

  procedure dlgShowMessage(const Caption, Msg: string);
  procedure dlgShowError(const Caption, Msg: string);

implementation

{$R *.dfm}

procedure dlgShowMessageDlg(Owner: TComponent; const Caption, Msg: string; IsError: boolean; Height: integer);
var
  frmMessage: TdlgMessage;
begin
  frmMessage:= TdlgMessage.Create(Owner);
  frmMessage.Caption:= Caption;
  frmMessage.lCaption.Caption:= Caption;
  frmMessage.lText.Caption:= Msg;
  frmMessage.Height:= Height;
  if IsError then begin
    frmMessage.Image_Error.Left:= 8;
    frmMessage.Image_Error.Top:= 34;
    frmMessage.Image_Error.Visible:= True;
  end else begin
    frmMessage.Image_Info.Left:= 8;
    frmMessage.Image_Info.Top:= 34;
    frmMessage.Image_Info.Visible:= True;
  end;
  frmMessage.ShowModal;
  frmMessage.Free;
end;

procedure dlgShowMessage(const Caption, Msg: string);
begin
  dlgShowMessageDlg({Application.MainForm} nil, Caption, Msg);
end;

procedure dlgShowError(const Caption, Msg: string);
begin
  dlgShowMessageDlg({Application.MainForm}nil, Caption, Msg, True);
end;

end.
